home *** CD-ROM | disk | FTP | other *** search
- Path: news.shentel.net!Global-PPP
- From: scicom@globalcom.net (stephen j beaver)
- Newsgroups: comp.lang.c
- Subject: Re: prefix vs. postfix
- Date: Wed, 03 Jan 96 23:18:05 GMT
- Organization: scicom research us inc
- Distribution: world
- Message-ID: <4cf35v$7il@head.globalcom.net>
- References: <4c1089$gro@nntpd2.cxo.dec.com> <tcpnntpd.15.12.30.11.27.18.2781597121.305087@the-fix.sos.on.ca> <30DEC199514333959@erich.triumf.ca>
- NNTP-Posting-Host: eb3ppp26.shentel.net
- X-Newsreader: News Xpress Version 1.0 Beta #2
-
- <SNIP>
-
- >The two operators _never_ do the same thing. However, if you just want the
- >side effect of the increment, but the value returned by i++ or ++i is not used,
- >(as in for(i = 0; i < 10; i++) ) it doesn't matter which is used.
-
- I thought that:
-
- for(i=0;i<10;i++)
- {
- loopbody(i):
- }
-
- Increments i after the loop so that the first value passed to loopbody() is zero, whereas:
-
- for(i=0;i<10;++i)
- {
- loopbody();
- }
-
- increments i before the loop body so that the first value passedtp loopbody() is 1 in this case.
-
- No?
-
- Steve
- >
-